package com.tt.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.tt.dao.UserDaoImpl;
import com.tt.entity.User;

@Service
public class UserserviceImpl {
	@Resource
	private UserDaoImpl uDaoImpl;
	//注册
	public boolean addUser(User user) {
		int save = uDaoImpl.save(user);
		if (save>0) {
			return true;
		}else {
			return false;
		}
	}
	//登录
		public User getloginUser(String email,String password){
		User user =	this.uDaoImpl.loginUser(email, password);
			if (user!= null) {
				return user;
			} else {
				return null;
			}
		}
	//修改
		 public boolean updateUser(User user){
			 this.uDaoImpl.updateUser(user);
			 return true;
		 }
		 public User toupdate(Integer id){
			 return this.uDaoImpl.toUpdateUser(id);
		 }
		//申请升级为商家
			public boolean upgrade(User user){
				this.uDaoImpl.upgrade(user);
				return true;
			}
}
